<!--
    qMenu Tester
    
    http://127.0.0.1:8100/qlibjs/webres/common/_test/qHtml/qMenuTester.html
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
    	<link rel="stylesheet" title="Screen Styles" href="../../qCore.css" type="text/css" media="screen">
        <title>qMenu Widget</title>
        <script>
            imagePath='../../images/';
            wrroot='../../';
            scriptPath='';
            contextPath='';
            bIsDev=true;
            bDebug=true;
        </script>
        <script src='../../jquery_exp.js'></script> 
        <script src='../../qCore.js'></script>   
        <script src='../../qBase.js'></script>   
        <script src='../../qHtml.js'></script>   
        <script src='../../qMenu.js'></script>
        
        <script>


        	
        	function __cmd_click(e, oEl, cmd, jArgs){
pc(
     "\n e = "+e
    +"\n oEl = "+oEl
    +"\n jArgs:\n"+s$.pad(q$.dump(jArgs))
    +"\n cmd:\n"+s$.pad(q$.dump(cmd))
);
        	}
        	
			function opt1_click(e,o){
//debug(
//     "\n e = "+e
//    +"\n o._mmId = "+o._mmId
////    +"\n o:\n"+s$.pad(q$.dumpJson(o))
//);
				agetElem(o._mmId).open({
					parent: o
				   ,position: qHtml.POS_BL
				});
	
			}
        	
        	function bodyLoaded(){
        		var
        			aCmds,oMM, oM2,oM3,oM4
        		;
        		
				pc("DEBUG -	Initializing Default qClient")
				__initDefQClient()
				qObjAppend(_qclient,{
					 val1: 1
					,val2: 2
				})
				
        		
        		aCmds=[]
        		aCmds.p({label: "M4 1 a", handler: __cmd_click, hArgs: {x: 1, y: 2, a: "A"}, activeExpr: "false"})
        		aCmds.p({label: "M4 2 aa", handler: __cmd_click, activeExpr: "true"})
        		aCmds.p({label: "M4 3 aaa", handler: __cmd_click, activeExpr: "false"})
        		aCmds.p({label: "<div id=divTestingxx >M4 4 aaaa</div>", handler: __cmd_click, activeExpr: "false"})
        		oM4=new qMenu({commands: aCmds, ofsX: -3, ofsY: 3, orphan: true})
        		
        		aCmds=[]
        		aCmds.p({label: "M3 1 a", handler: __cmd_click})
        		aCmds.p({label: "M3 2 aa", subMenu: oM4})
        		aCmds.p({label: "M3 3 aaa", handler: __cmd_click})
        		aCmds.p({label: "M3 4 aaaa", handler: __cmd_click})
        		oM3=new qMenu({commands: aCmds, ofsX: -3, ofsY: 3})
        		
        		aCmds=[]
        		aCmds.p({label: "M2 1 a", handler: __cmd_click})
        		aCmds.p({label: "M2 2 aa", handler: __cmd_click})
        		aCmds.p({label: "M2 3 aaa", subMenu: oM3})
        		aCmds.p({label: "M2 4 aaaa", handler: __cmd_click})
        		oM2=new qMenu({commands: aCmds, ofsX: -3, ofsY: 3})
        		
        		aCmds=[]
        		aCmds.p({label: "M2b 1 a", handler: __cmd_click, activeExpr: "qc.val1 == m.test1", disabledMsg: "You have no rights..."})
        		aCmds.p({label: "M2b 2 aa", handler: __cmd_click})
        		aCmds.p({label: "M2b 3 aaa &nbsp;<img src='"+imagePath+"spinner_large.gif' style='cursor: move; vertical-align: top' >", handler: __cmd_click})
        		aCmds.p({label: "M2b 4 aaaa", handler: __cmd_click})
        		oM2b=new qMenu({commands: aCmds, ofsX: -3, ofsY: 3})
        		
        		aCmds=[]
        		aCmds.p({label: "MM 1 a", handler: __cmd_click})
        		aCmds.p({label: "MM 2 aa", handler: __cmd_click})
        		aCmds.p({label: "MM 3 aaa", handler: __cmd_click, icon: "CalButton.gif"})
        		aCmds.p({label: "MM 3 aaa", subMenu: oM2b})
        		aCmds.p({label: "MM 4 aaaa", subMenu: oM2})
        		
        		
//        		oMM=new qMenu({
//        			commands: aCmds
//        		   ,main: true
//        		   ,type: qMenu.TYPE_vert
//        		   ,menuCtnr: agetElem("divMenu")
//        		   ,width: 100
//        		})

        		oMM=new qMenu({commands: aCmds, main: true, exprEnv: "var qc=_qclient", exprDat: {test1: 2}})
        		oOptBox=agetElem("opt1")
        		oOptBox._mmId=oMM.getFltElem().id
        		
oMM.rebuild()
//oMM.rebuild()
//oMM.rebuild()
//oMM.rebuild()
        		
        		
oFlt=oMM.getFltElem();
//debug(
//     "\n oFlt = "+oFlt
//    +"\n oMM = "+oMM
//    +"\n oFlt.id = "+oFlt.id
//    +"\n oOptBox = "+oOptBox
//    +"\n oFlt.innerHTML = "+oFlt.innerHTML
//);

        		
        		

        		
        		o=oMM.getFltElem()     		
//pc(
//     "\n oM4 = "+oM4
//    +"\n oM3 = "+oM3
//    +"\n oM2 = "+oM2
//    +"\n oMM = "+oMM
//    +"\n o = "+o
//    +"\n o.innerHTML = "+o.innerHTML
//);

        	}
        </script>

    </head>
    <body>
    	
    	<script>
    		var h=qHtml,bModify=true
			dw (
			    h.frmForm("fmTest")
	            +"\n<div style='color: #555; background: #ffffef; padding: 3px; border: 1px solid #999999' width='20px'>"
	                +"\n<img src='"+imagePath+"CalButton.gif' height='16px' style='text-align: top'>&nbsp;&nbsp;"
	                +"\n<b id='tfAnHead' style='font-size:100%; line-height: 2.5em'>qMenu Tester</b>"
			   +"\n"+"</div>"
			   +"\n"+"</form>"
			   +"\n<span id=divMenu style='width: 30px'><span>"
			)
			
			dw (
				"<table border=0>"
				+"<tr><td width=200px>"
			   +qHtml.curveBox(
						 "<table cellpaddin=0 cellspacing=0 width=100% style=''>"
						 	+"<tr>"
						 		+"<td style='font-size: 80%; color: white;' width=100%>Some Section</td>"
						 		+"<td align=right>"
						 		+qMenu.optBox({id: 'opt1',onclick:'opt1_click(event,this)', color: '#ffffef', bgImg: 'hg26-003366-3c78b6.gif'})//, bgImgOn: 'hg20-3c78b6-67a7e3.gif'
						 		+"</td>"
						 	+"</tr>"
						 +"</table>"
						,{bgColor: "7799bb",radius: 4,corners: [0,1,0,0], width: "100%"}
				)
			   +"</td><td>&nbsp</td>"
			   +"</tr></table>"
			)
    	</script>
    	
    	
	<script>
        bConsole=false; __qcOpts={cb:true, t:0, w: 600, h: 500}
	    _SCR_START=" bodyLoaded();"; function __start() {try{if(bConsole){startCons(__qcOpts); _w.consoleLoaded = function consoleLoaded(){ setTimeout(_SCR_START,50) }}else{eval(_SCR_START)}}catch(e){debugErr(e)}};__start()
    </script>
    
	</body>
</html>
